import { View, Text } from '@tarojs/components'
import Taro from '@tarojs/taro'
import './Settings.scss'

const Settings = () => {
  const goHome = () => {
    Taro.switchTab({ url: '/pages/home/home' })
  }

  const handleLogout = () => {
    Taro.removeStorageSync('token')
    Taro.reLaunch({ url: '/pages/login/login' })
  }

  return (
    <View className='settings'>
      <View className='pageTitle'>
        <Text className='goBack' onClick={goHome}>
          {'<'}
        </Text>
        设置
      </View>
      <View className='operationList'>
        <View className='operation-item'>
          <Text>状态提醒</Text>
          <Text>{'>'}</Text>
        </View>
        <View className='operation-item'>
          <Text>切换账号</Text>
          <Text>{'>'}</Text>
        </View>
        <View className='operation-item' onClick={handleLogout}>
          <Text>退出登录</Text>
          <Text>{'>'}</Text>
        </View>
        <View className='operation-item'>
          <Text>账号信息</Text>
          <Text>{'>'}</Text>
        </View>
        <View className='operation-item'>
          <Text>版本信息</Text>
          <Text>{'>'}</Text>
        </View>
      </View>
    </View>
  )
}

export default Settings